package shared;

import java.io.Serializable;
import java.util.ArrayList;

@SuppressWarnings("rawtypes")
public class DataServerState implements Serializable, Comparable
{

    private static final long serialVersionUID = 5555L;

    private String hostName;

    // store the variable Space in unit of bytes
    private long availableSpace;

    private int numberOfFiles;

    private ArrayList<Long> fileIDs;

    private DataServerInterface remoteDataServer;

    private long lastActiveTime;

    public DataServerInterface getRemoteDataServer()
    {
	return remoteDataServer;
    }

    public void setRemoteDataServer(DataServerInterface remoteDataServer)
    {
	this.remoteDataServer = remoteDataServer;
    }

    public String getHostName()
    {
	return hostName;
    }

    public void setHostName(String hostName)
    {
	this.hostName = hostName;
    }

    public long getAvailableSpace()
    {
	return availableSpace;
    }

    public void setAvailableSpace(long l)
    {
	this.availableSpace = l;
    }

    public int getNumberOfFiles()
    {
	return numberOfFiles;
    }

    public void setNumberOfFiles(int numberOfFiles)
    {
	this.numberOfFiles = numberOfFiles;
    }

    public ArrayList<Long> getFileIDs()
    {
	return fileIDs;
    }

    public void setFileIDs(ArrayList<Long> fileIDs)
    {
	this.fileIDs = fileIDs;
    }

    public long getLastActiveTime()
    {
	return lastActiveTime;
    }

    public void setLastActiveTime(long lastActiveTime)
    {
	this.lastActiveTime = lastActiveTime;
    }

    @Override
    public int compareTo(Object o)
    {
	DataServerState otherState = (DataServerState) o;
	if (this.numberOfFiles < otherState.getNumberOfFiles())
	    return -1;
	else if (this.numberOfFiles == otherState.getNumberOfFiles())
	    return 0;
	else
	    return 1;
    }

}
